package com.wwh.furns.utils;

import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;

/**
 * @author Albert
 * @date 2024/8/12-20:34
 * @describe
 */
public class WebUtils {
    public static String FURN_IMG6_DIRECTORY = "assets/images/product-image";


    /**
     * 判断是否是ajax请求
     * @param req
     * @return
     */
    public static boolean isAjaxRequest(HttpServletRequest req){
        return "XMLHttpRequest".equals(req.getHeader("X-Requested-With"));
    }

    public static String getYearMonthDay() {
        //如何得到当前的日期-> java基础 日期 三代类
        LocalDateTime ldt = LocalDateTime.now();
        int year = ldt.getYear();
        int monthValue = ldt.getMonthValue();
        int dayOfMonth = ldt.getDayOfMonth();
        String yearMonthDay = year + "/" + monthValue + "/" + dayOfMonth + "/";
        return yearMonthDay;
    }
}
